package com.woniu.ly.ticketassembly.rabbitMQ;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

@Component
@Slf4j
public class RabbitMQListener {

    @RabbitListener(queues = "hot.travel.queue")
    public void hotTravelMessage(Map<String,Object> message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException {
        log.info("收到热门旅游推送消息：{}",message);
        //channel.basicNack(tag,false,true);
        channel.basicAck(tag,false);
    }



}
